package main

import (
	"com.go-micro.code/todolist/go-micro-todolist/task/config"
	"com.go-micro.code/todolist/go-micro-todolist/task/core"
	"com.go-micro.code/todolist/go-micro-todolist/task/services"
	"go-micro.dev/v4"
	"log"
)

func main() {
	//1.配置文件初始化
	err := config.Init()
	if err != nil {
		log.Fatalln(err)
	}
	//2.创建micro服务，默认mdns注册
	srv := micro.NewService(
		micro.Name("taskService"),
		micro.Address(":8081"),
	)
	//3.解析命令行参数，初始化
	srv.Init()
	//4.服务注册
	services.RegisterTaskServiceHandler(srv.Server(), new(core.TaskService))
	//5.服务启动
	srv.Run()

}
